package com.zkdcloud.service;

import com.zkdcloud.domain.BusinessActivity;
import com.zkdcloud.repository.BusinessActivityDao;
import com.zkdcloud.util.RandomUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BusinessActivityService {

    @Autowired
    private BusinessActivityDao businessActivityDao;

    public void  add(BusinessActivity businessActivity){
        businessActivity.setIconColor("#cccccc");
        businessActivity.setCreateTime(System.currentTimeMillis());
        businessActivity.setId(RandomUtil.getUUID());
        businessActivity.setIconName("icon");
        businessActivityDao.add(businessActivity);
    }

    public void remove(String id){
        businessActivityDao.remove(id);
    }

    public void update(BusinessActivity businessActivity){
        businessActivityDao.update(businessActivity);
    }

    public List<BusinessActivity> getListByBusinessId(String bid){
        return businessActivityDao.getAllByBid(bid);
    }
}
